package com.djakapm.markdown.editor.action;

import com.djakapm.markdown.editor.AppConstant;
import com.djakapm.markdown.editor.Application;
import com.djakapm.markdown.editor.util.ResourceManager;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class NewFileAction extends AbstractAction {
    private Application application;

    public NewFileAction(Application application){
        this.application = application;
        this.putValue(Action.SMALL_ICON, ResourceManager.getIcon(AppConstant.NEW_ICON_NAME));
        this.putValue(Action.SHORT_DESCRIPTION, AppConstant.NEW_FILE_TOOLTIP_LABEL);
        this.putValue(Action.NAME, AppConstant.NEW_FILE_LABEL);
    }

    public void actionPerformed(ActionEvent e) {
        this.application.addContent();
    }
}
